package artexercise;

public class SubtractionExpression extends ArithmeticExpression {

    public SubtractionExpression(int operand1, int operand2) {
        super(operand1, operand2);
        this.operator = "-";
    }

    @Override
    public void calculate() {
        this.result = operand1 - operand2;
    }

    @Override
    public boolean isValid() {
        return result >= 0; // 减法结果不能为负数
    }
}